package com.heima.article.feign;

import com.heima.apis.article.IArticleClient;
import com.heima.article.service.ApArticleService;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2023/2/2 10:20
 * @Version 1.0
 */
@RestController
public class ArticleClient implements IArticleClient {

    @Autowired
    private ApArticleService articleService;

    @Override
    @PostMapping("/api/v1/article/save")
    public ResponseResult saveArticle(ArticleDto dto) {
        return articleService.saveArticle(dto);
    }

    @Override
    @PostMapping("/api/v1/article/{articleId}")
    public ApArticle getArticleById(Long articleId) {
        return articleService.getArticleById(articleId);
    }
}